const int LIGHT_MAX = 4;
struct light
{
	int type;
	vec3 light;//光源坐标
	float intensity;//光强
};
uniform sampler2D tex0;
uniform vec3 inAmbientCoefficient;
uniform light inLight[LIGHT_MAX];
varying vec2 outTexCoord;
varying float outDiffuse[LIGHT_MAX];
varying vec3 outSpecular[LIGHT_MAX];

void main()
{
	vec3 color = vec3(0.0);
	for (int i=0; i<LIGHT_MAX; ++i)
	{
		if(inLight[i].type>0)
		{
			color += inAmbientCoefficient+vec3(texture2D(tex0,outTexCoord))*outDiffuse[i]+outSpecular[i];
		}
	}
	gl_FragColor=vec4(color, 1.0);
}